<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<lv-form [formGroup]="formGroup" class="formGroup lv-form-label-required">
    <lv-form-item>
        <lv-form-label>
            {{'common_name_label' | i18n}}
        </lv-form-label>
        <lv-form-control>
            <input lv-input type="text" formControlName="name">
        </lv-form-control>
    </lv-form-item>
    <lv-form-item>
        <lv-form-label>
            {{'protection_storage_device_label' | i18n}}
        </lv-form-label>
        <lv-form-control>
            <lv-select formControlName="device" [lvOptions]="deviceOptions" lvValueKey="value" lvShowFilter
                lvFilterKey="label" lvFilterMode="contains"></lv-select>
        </lv-form-control>
    </lv-form-item>
    <lv-form-item>
        <lv-form-label>
            {{'common_tenant_label' | i18n}}
        </lv-form-label>
        <lv-form-control>
            <lv-select formControlName="tenant" [lvOptions]="tenantOptions" lvValueKey="value" lvShowFilter
                lvFilterKey="label" lvFilterMode="contains"></lv-select>
        </lv-form-control>
    </lv-form-item>
</lv-form>

<div class="aui-gutter-column-xl tenantTable" *ngIf="hasTenant">
    <lv-datatable [lvData]="tenantData" #tenantTable lvResize lvFake>
        <thead>
            <tr>
                <th>
                    {{'common_gateway_label' | i18n}}
                </th>
                <th>
                    <span class="star">*</span>
                    {{'common_mask_ip_label' | i18n}}
                </th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>
                    <lv-form [formGroup]="formGroup" class='migrate-host-container'>
                        <lv-form-control [lvErrorTip]="baseUtilService.ipErrorTip">
                            <input lv-input formControlName="gateway" type="text" class="add-input-container">
                        </lv-form-control>
                    </lv-form>
                </td>
                <td>
                    <lv-form [formGroup]="formGroup" class='migrate-host-container'>
                        <lv-form-control [lvErrorTip]="maskErrorTip">
                            <input lv-input formControlName="mask" type="text" class="add-input-container">
                        </lv-form-control>
                    </lv-form>
                </td>
            </tr>
        </tbody>
    </lv-datatable>
</div>